



use "$path\datasets\externalVal_data.dta", clear

keep if in_hand_coll_sample==1

estpost sum  log_bevoelkerung log_unter_14jahre log_ueber65jahre log_von15bis65jahre log_totrev_pc log_ts_pc mean_sum_elected_hcd  mean_tot_share_women_elected mean_cdu_seat_share   mean_spd_seat_share    if in_estimation_sample==0
matrix meanf1=e(mean)
matrix list meanf1
estpost sum  log_bevoelkerung log_unter_14jahre log_ueber65jahre log_von15bis65jahre log_totrev_pc log_ts_pc mean_sum_elected_hcd  mean_tot_share_women_elected mean_cdu_seat_share   mean_spd_seat_share    if in_estimation_sample==1
matrix meanf2=e(mean)
matrix list meanf2


estpost ttest  log_bevoelkerung log_unter_14jahre log_ueber65jahre log_von15bis65jahre log_totrev_pc log_ts_pc mean_sum_elected_hcd  mean_tot_share_women_elected mean_cdu_seat_share   mean_spd_seat_share, by(in_estimation_sample)
estadd matrix meanf1
estadd matrix meanf2


esttab  using TableA33/tableA33.txt, replace order(   log_bevoelkerung log_unter_14jahre log_ueber65jahre log_von15bis65jahre log_totrev_pc log_ts_pc    ) cells("meanf1(fmt(3))  meanf2(fmt(3))   b(star fmt(3)) se(fmt(3)) count(fmt(0))") star(* 0.1 ** .05 *** 0.01) ///
  collabels(  "Not in sample"  "In sample" "Diff." "Std. Error" "Obs.") ///
  varlabels(log_bevoelkerung "Log(Population)" log_unter_14jahre "Log(Population $<$ 14)"  log_ueber65jahre "Log(Population $>$ 65)"  log_von15bis65jahre "Log(Population $>$14 \& $<$ 65)"  log_totrev_pc "Log(Revenues p.c.)"   log_ts_pc "Log(Transfers p.c.)" sum_elected_hcd "Council size"  tot_share_women_elected "\% Women" cdu_seat_share "\% CSU"   spd_seat_share "\% SPD" mean_sum_elected_hcd "Council size"  mean_tot_share_women_elected "\% Women" mean_cdu_seat_share "\% CSU"   mean_spd_seat_share "\% SPD" mean_left_seat_share "\% Left-wing parties" ) 



